<?php

namespace Wx\ApiBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * WeixinUser
 */
class WeixinUser
{
    /**
     * @var integer
     */
    private $id;

    /**
     * @var string
     */
    private $openid;

    /**
     * @var string
     */
    private $nickname;

    /**
     * @var boolean
     */
    private $sex;

    /**
     * @var string
     */
    private $city;

    /**
     * @var string
     */
    private $country;

    /**
     * @var string
     */
    private $province;

    /**
     * @var string
     */
    private $language;

    /**
     * @var string
     */
    private $headimgurl;

    /**
     * @var boolean
     */
    private $subscribe;

    /**
     * @var integer
     */
    private $subscribeTime;

    /**
     * @var \Wx\ApiBundle\Entity\UserConfig
     */
    private $userConfig;


    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set openid
     *
     * @param string $openid
     * @return WeixinUser
     */
    public function setOpenid($openid)
    {
        $this->openid = $openid;

        return $this;
    }

    /**
     * Get openid
     *
     * @return string 
     */
    public function getOpenid()
    {
        return $this->openid;
    }

    /**
     * Set nickname
     *
     * @param string $nickname
     * @return WeixinUser
     */
    public function setNickname($nickname)
    {
        $this->nickname = $nickname;

        return $this;
    }

    /**
     * Get nickname
     *
     * @return string 
     */
    public function getNickname()
    {
        return $this->nickname;
    }

    /**
     * Set sex
     *
     * @param boolean $sex
     * @return WeixinUser
     */
    public function setSex($sex)
    {
        $this->sex = $sex;

        return $this;
    }

    /**
     * Get sex
     *
     * @return boolean 
     */
    public function getSex()
    {
        return $this->sex;
    }

    /**
     * Set city
     *
     * @param string $city
     * @return WeixinUser
     */
    public function setCity($city)
    {
        $this->city = $city;

        return $this;
    }

    /**
     * Get city
     *
     * @return string 
     */
    public function getCity()
    {
        return $this->city;
    }

    /**
     * Set country
     *
     * @param string $country
     * @return WeixinUser
     */
    public function setCountry($country)
    {
        $this->country = $country;

        return $this;
    }

    /**
     * Get country
     *
     * @return string 
     */
    public function getCountry()
    {
        return $this->country;
    }

    /**
     * Set province
     *
     * @param string $province
     * @return WeixinUser
     */
    public function setProvince($province)
    {
        $this->province = $province;

        return $this;
    }

    /**
     * Get province
     *
     * @return string 
     */
    public function getProvince()
    {
        return $this->province;
    }

    /**
     * Set language
     *
     * @param string $language
     * @return WeixinUser
     */
    public function setLanguage($language)
    {
        $this->language = $language;

        return $this;
    }

    /**
     * Get language
     *
     * @return string 
     */
    public function getLanguage()
    {
        return $this->language;
    }

    /**
     * Set headimgurl
     *
     * @param string $headimgurl
     * @return WeixinUser
     */
    public function setHeadimgurl($headimgurl)
    {
        $this->headimgurl = $headimgurl;

        return $this;
    }

    /**
     * Get headimgurl
     *
     * @return string 
     */
    public function getHeadimgurl()
    {
        return $this->headimgurl;
    }

    /**
     * Set subscribe
     *
     * @param boolean $subscribe
     * @return WeixinUser
     */
    public function setSubscribe($subscribe)
    {
        $this->subscribe = $subscribe;

        return $this;
    }

    /**
     * Get subscribe
     *
     * @return boolean 
     */
    public function getSubscribe()
    {
        return $this->subscribe;
    }

    /**
     * Set subscribeTime
     *
     * @param integer $subscribeTime
     * @return WeixinUser
     */
    public function setSubscribeTime($subscribeTime)
    {
        $this->subscribeTime = $subscribeTime;

        return $this;
    }

    /**
     * Get subscribeTime
     *
     * @return integer 
     */
    public function getSubscribeTime()
    {
        return $this->subscribeTime;
    }

    /**
     * Set userConfig
     *
     * @param \Wx\ApiBundle\Entity\UserConfig $userConfig
     * @return WeixinUser
     */
    public function setUserConfig(\Wx\ApiBundle\Entity\UserConfig $userConfig = null)
    {
        $this->userConfig = $userConfig;

        return $this;
    }

    /**
     * Get userConfig
     *
     * @return \Wx\ApiBundle\Entity\UserConfig 
     */
    public function getUserConfig()
    {
        return $this->userConfig;
    }

    /**
     * @ORM\PrePersist
     */
    public function setCreatedAtValue() {
        if (!$this->getCreatedAt()) {
            $this->created_at = new \DateTime();
        }
    }

    /**
     * @ORM\PreUpdate
     */
    public function setUpdatedAtValue() {
        $this->updated_at = new \DateTime();
    }
}
